about alienlang!!!!!!!!!!!!!!!!!!
is it compiled? am i dum? no, it is an interpreted language!
is it cool? yes, it is!
is it easy to learn? yes, it is!
is it good for making games? no!
it's in v 0.1, so it is still being worked on!
it is made in python!
the interpretor is written in python!
it is open source!
it is free!
it is made by aliencool!
it is a very simple language!
----IGNORE----
var's!
num (with <>) is to store numbers!
per example: num.#+10 to plus 10 to the num!
per example: num.#-10 to minus 10 to the num!
per example: num.#*10 to times 10 to the num!
per example: num.#/10 to divide 10 to the num!
per example: num=10 can be wrong to set the num to 10!
per example: saytalk #num to print the num!
mlang save file format!
alienlang save files are .mlang files!
you can open them with alieneditor!
idk about other text editors!
it is a very simple file format!
download/build and run alienlang!
download the python text editor for alienlang!
you can also build it from source!
build and run:
#
def tokenize(code):
return [line.strip() for line in code.strip().splitlines() if line.strip()]
def interpret(lines):
env = {}
current_var = None
for line in lines:
if line.startswith("")
current_var = var_name
env[current_var] = 0
elif line.startswith(""))
if current_var:
env[current_var] = value
else:
raise RuntimeError("No variable declared to assign value to.")
elif line.startswith(""))
if current_var and current_var in env:
env[current_var] += add_value
else:
raise RuntimeError("No variable available to add to.")
elif line.startswith(""))
if current_var and current_var in env:
env[current_var] -= sub_value
else:
raise RuntimeError("No variable available to subtract from.")
elif line == "": # Print current var
if current_var and current_var in env:
print(env[current_var])
else:
raise RuntimeError("No variable to print.")
else:
raise SyntaxError(f"Unknown command: {line}")
# === Sample Program ===
if __name__ == "__main__":
code = """
lines = tokenize(code)
interpret(lines)
layed out !
oh! and num. ic= is to declare a num var's name (rip-off of id )!
the editor code!
import tkinter as tk
from tkinter import filedialog, messagebox
# ==== AlienLang Interpreter ====
def tokenize(code):
return [line.strip() for line in code.strip().splitlines() if line.strip()]
def interpret(lines):
env = {}
current_var = None
output = ""
for line in lines:
if line.startswith("")
current_var = var_name
env[current_var] = 0
elif line.startswith(""))
if current_var:
env[current_var] = value
else:
raise RuntimeError("No variable declared to assign value to.")
elif line.startswith(""))
if current_var and current_var in env:
env[current_var] += add_value
else:
raise RuntimeError("No variable available to add to.")
elif line.startswith(""))
if current_var and current_var in env:
env[current_var] -= sub_value
else:
raise RuntimeError("No variable available to subtract from.")
elif line.startswith("")
output += text + "\n"
else:
if current_var and current_var in env:
output += str(env[current_var]) + "\n"
else:
raise RuntimeError("No variable to print.")
else:
raise SyntaxError(f"Unknown command: {line}")
return output
# ==== GUI Functions ====
def run_code():
code = text_input.get("1.0", tk.END)
try:
lines = tokenize(code)
output = interpret(lines)
output_box.config(state="normal")
output_box.delete("1.0", tk.END)
output_box.insert(tk.END, output if output else "[No output]")
output_box.config(state="disabled")
except Exception as e:
messagebox.showerror("Error", str(e))
def save_file():
file_path = filedialog.asksaveasfilename(defaultextension=".mlang", filetypes=[("AlienLang Files", "*.mlang")])
if file_path:
with open(file_path, "w") as f:
code = text_input.get("1.0", tk.END)
f.write(code)
def load_file():
file_path = filedialog.askopenfilename(defaultextension=".mlang", filetypes=[("AlienLang Files", "*.mlang")])
if file_path:
with open(file_path, "r") as f:
code = f.read()
text_input.delete("1.0", tk.END)
text_input.insert("1.0", code)
# ==== GUI Setup ====
root = tk.Tk()
root.title("👽 AlienLang Studio")
# Menu
menu = tk.Menu(root)
file_menu = tk.Menu(menu, tearoff=0)
file_menu.add_command(label="Open .mlang File", command=load_file)
file_menu.add_command(label="Save .mlang File", command=save_file)
menu.add_cascade(label="File", menu=file_menu)
root.config(menu=menu)
# Text Input Area
text_input = tk.Text(root, height=15, width=60, font=("Courier", 12))
text_input.pack(padx=10, pady=10)
# Run Button
run_button = tk.Button(root, text="â–¶ Run Code", command=run_code, bg="green", fg="white", font=("Arial", 12))
run_button.pack(pady=5)
# Output Area
output_box = tk.Text(root, height=6, width=60, font=("Courier", 12), bg="#f0f0f0", state="disabled")
output_box.pack(padx=10, pady=10)
# Start GUI
root.mainloop()